<%@page import="com.pswv2.util.Configs"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta charset="utf-8">
	<title>修改文件 - ${siteName}</title>
	<meta name="description" content="">
	<meta name="author" content="xuzewei">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
	<link rel="stylesheet" type="text/css" href="css/cloud-admin.css" >
	<link rel="stylesheet" type="text/css" href="css/themes/default.css" id="skin-switcher" >
	<link rel="stylesheet" type="text/css" href="css/responsive.css" >
	<link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.min.css">
	<!-- JQUERY UI-->
	<link rel="stylesheet" type="text/css" href="js/jquery-ui-1.10.3.custom/css/custom-theme/jquery-ui-1.10.3.custom.min.css" />
	<!-- DATE RANGE PICKER -->
	<link rel="stylesheet" type="text/css" href="js/bootstrap-daterangepicker/daterangepicker-bs3.css" />
	<!-- JQGRID -->
	<link rel="stylesheet" type="text/css" href="js/jqgrid/css/ui.jqgrid.min.css" />
	<!-- HUBSPOT MESSENGER -->
	<link rel="stylesheet" type="text/css" href="js/hubspot-messenger/css/messenger.min.css" />
	<link rel="stylesheet" type="text/css" href="js/hubspot-messenger/css/messenger-theme-flat.min.css" />
	<link rel="stylesheet" type="text/css" href="css/base.css" />
	<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body id="app" ng-app="app" ng-controller="ctrl">
	<!-- HEADER -->
	<jsp:include page="include/header.jsp" />
	<!--/HEADER -->
	<!-- PAGE -->
	<section id="page">
		<!-- SIDEBAR -->
		<jsp:include page="include/sidebar.jsp" />
		<!-- /SIDEBAR -->
		<div id="main-content">
			<div class="container">
				<div class="row">
					<div id="content" class="col-lg-12">
						<!-- PAGE HEADER-->
						<div class="row">
							<div class="col-sm-12">
								<div class="page-header">
									<!-- BREADCRUMBS -->
									<ul class="breadcrumb">
										<li>
											<i class="fa fa-home"></i>
											<a href="welcome.jsp">Home</a>
										</li>
									</ul>
									<!-- /BREADCRUMBS -->
									<div class="clearfix">
										<h3 class="content-title pull-left">修改文件</h3>
									</div>
									<div class="description"></div>
								</div>
							</div>
						</div>
						<!-- /PAGE HEADER -->
						<div class="box border orange">
							<div class="box-title">
								<h4><i class="fa fa-bars"></i>修改文件</h4>
							</div>
							<div class="box-body big">
								<form role="form">
								<div class="form-group">
									  <label>选择分类</label> <select ng-model="resp.categoryId" class="form-control"
											ng-options="o.categoryId as o.name for o in allCategory" >
										</select>
									</div>
									<div class="form-group">
									  <label>修改关键字</label>
									  <input type="text" class="form-control" ng-model="resp.kWords" >
									</div>
									<div class="form-group">
									  <label>修改子文件</label>
									  <textarea class="form-control" ng-model="resp.content" ></textarea>
									</div>
									<button type="submit" class="btn btn-danger" ng-click="submit()">提交</button>
								</form>
							</div>
						</div>
						<div class="footer-tools">
							<span class="go-top">
								<i class="fa fa-chevron-up"></i> Top
							</span>
						</div>
					</div><!-- /CONTENT-->
				</div>
			</div>
		</div>
	</section>
	<!--/PAGE -->
	
	<!-- JAVASCRIPTS -->
	<!-- Placed at the end of the document so the pages load faster -->
	<!-- JQUERY -->
	<script src="js/jquery/jquery-2.0.3.min.js"></script>
	<!-- JQUERY UI-->
	<script src="js/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js"></script>
	<!-- BOOTSTRAP -->
	<script src="bootstrap-dist/js/bootstrap.min.js"></script>
	<!-- DATE RANGE PICKER -->
	<script src="js/bootstrap-daterangepicker/moment.min.js"></script>
	<script src="js/bootstrap-daterangepicker/daterangepicker.min.js"></script>
	<!-- SLIMSCROLL -->
	<script type="text/javascript" src="js/jQuery-slimScroll-1.3.0/jquery.slimscroll.min.js"></script>
	<script type="text/javascript" src="js/jQuery-slimScroll-1.3.0/slimScrollHorizontal.min.js"></script>
	<!-- BLOCK UI -->
	<script type="text/javascript" src="js/jQuery-BlockUI/jquery.blockUI.min.js"></script>
	<!-- JQGRID -->
	<script type="text/javascript" src="js/jqgrid/js/grid.locale-en.min.js"></script>
	<script type="text/javascript" src="js/jqgrid/js/jquery.jqGrid.min.js"></script>
	<!-- COOKIE -->
	<script type="text/javascript" src="js/jQuery-Cookie/jquery.cookie.min.js"></script>
	<!-- HUBSPOT MESSENGER -->
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger.min.js"></script>
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger-theme-flat.js"></script>
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger-theme-future.js"></script>
	<!-- ANGULAR-LIBRARY -->
	<script src="angular-1.5.0-rc.2/angular.js"></script>
	<script src="js/script.js"></script>
	<!-- CUSTOM SCRIPT -->
	<script src="include/common.js"></script>
	<script>
	var app = angular.module("app", []);
	app.controller('ctrl', function($scope, $http, $httpParamSerializer, $injector, $window) {
		$scope.kwords = {
			"id": "${param.id}"
		}
		//显示内容
		$scope.reload = function() {
			var reqDate = jQuery.param({
					"id": $scope.kwords.id
			});
			var reqConfig = { headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"} };
			$http.post(
				"api/keysAcion/queryById", reqDate, reqConfig
			).success(function(data, status) {
				if (isErr(data)) {
					showErrMsg(data);
					return;
				}
				$scope.resp = data.response;
			}).error(function(data, status) {
				showNetworkErrMsg(data, status);
			});
			
		};
		//提交修改
		$scope.submit = function() {
				var param = {
						"id":$scope.kwords.id,
						"kwords" : $scope.resp.kWords,
						"content" : $scope.resp.content,
						"categoryId": $scope.resp.categoryId,
				};
				
			jQuery.post("api/keysAcion/edit",param, function(data) {
					isErr(data) ? showErrMsg(data): showMsg('修改成功！');
					//$window.location.href="meeting_room_list.jsp";
							});
				}
		
		$scope.logout = function() {
			logout($window);
		};
		
		$scope.queryAllCategory = function() {
			var reqDate = jQuery.param({});
			var reqConfig = {headers : {"Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8"}};
			$http.post("api/categoryAcion/listAll",reqDate, reqConfig)
				.success(function(data, status) {
						if (isErr(data)) {
							showErrMsg(data);
							return;
										}
				$scope.allCategory = data.response;
				}).error(
							function(data, status) {
							showNetworkErrMsg(data,status);
				});
		}
	});
	</script>
 
	<script>
	jQuery(document).ready(function() {
		App.init();
		jQuery('#nav_article').click();
		setTimeout(function () {
			var scope = angular.element('#app').scope();
			scope.reload();
			scope.queryAllCategory();
		}, 500);
		
	});
	</script>

	<!-- /JAVASCRIPTS -->
</body>
</html>